//
// CMeshMultiLod.java
// Copyright (C) 2010  "Naush" <naush _ hotmail _ fr>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>./* ----------------------------------------------------------------------------







package org.ryzom.nel.threed;

import org.ryzom.nel.misc.IStream;

public class CMeshMultiLod extends CMeshBase {
  private long swigCPtr;

  public CMeshMultiLod(long cPtr, boolean cMemoryOwn) {
    super(nel3dJNI.CMeshMultiLod_SWIGUpcast(cPtr), cMemoryOwn);
    swigCPtr = cPtr;
  }

  public static long getCPtr(CMeshMultiLod obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        nel3dJNI.delete_CMeshMultiLod(swigCPtr);
      }
      swigCPtr = 0;
    }
    super.delete();
  }

  public void build(SWIGTYPE_p_NL3D__CMeshMultiLod__CMeshMultiLodBuild mbuild) {
    nel3dJNI.CMeshMultiLod_build(swigCPtr, this, SWIGTYPE_p_NL3D__CMeshMultiLod__CMeshMultiLodBuild.getCPtr(mbuild));
  }

  public CTransformShape createInstance(CScene scene) {
    long cPtr = nel3dJNI.CMeshMultiLod_createInstance(swigCPtr, this, CScene.getCPtr(scene), scene);
    return (cPtr == 0) ? null : new CTransformShape(cPtr, false);
  }

  public boolean clip(SWIGTYPE_p_std__vectorT_NLMISC__CPlane_t pyramid, SWIGTYPE_p_NLMISC__CMatrix worldMatrix) {
    return nel3dJNI.CMeshMultiLod_clip(swigCPtr, this, SWIGTYPE_p_std__vectorT_NLMISC__CPlane_t.getCPtr(pyramid), SWIGTYPE_p_NLMISC__CMatrix.getCPtr(worldMatrix));
  }

  public void render(IDriver drv, CTransformShape trans, boolean passOpaque) {
    nel3dJNI.CMeshMultiLod_render(swigCPtr, this, IDriver.getCPtr(drv), drv, CTransformShape.getCPtr(trans), trans, passOpaque);
  }

  public void getAABBox(SWIGTYPE_p_NLMISC__CAABBox bbox) {
    nel3dJNI.CMeshMultiLod_getAABBox(swigCPtr, this, SWIGTYPE_p_NLMISC__CAABBox.getCPtr(bbox));
  }

  public void serial(IStream f) {
    nel3dJNI.CMeshMultiLod_serial(swigCPtr, this, IStream.getCPtr(f), f);
  }

  public void profileSceneRender(CRenderTrav rdrTrav, CTransformShape trans, boolean opaquePass) {
    nel3dJNI.CMeshMultiLod_profileSceneRender(swigCPtr, this, CRenderTrav.getCPtr(rdrTrav), rdrTrav, CTransformShape.getCPtr(trans), trans, opaquePass);
  }

  public void buildSystemGeometry() {
    nel3dJNI.CMeshMultiLod_buildSystemGeometry(swigCPtr, this);
  }

  public IMeshGeom getMeshGeom(long slot) {
    return new IMeshGeom(nel3dJNI.CMeshMultiLod_getMeshGeom(swigCPtr, this, slot), false);
  }

  public long getNumSlotMesh() {
    return nel3dJNI.CMeshMultiLod_getNumSlotMesh(swigCPtr, this);
  }

  public IMeshGeom getSlotMesh(long i, SWIGTYPE_p_bool coarseMesh) {
    long cPtr = nel3dJNI.CMeshMultiLod_getSlotMesh(swigCPtr, this, i, SWIGTYPE_p_bool.getCPtr(coarseMesh));
    return (cPtr == 0) ? null : new IMeshGeom(cPtr, false);
  }

  public boolean isStatic() {
    return nel3dJNI.CMeshMultiLod_isStatic(swigCPtr, this);
  }

  public void changeMRMDistanceSetup(float distanceFinest, float distanceMiddle, float distanceCoarsest) {
    nel3dJNI.CMeshMultiLod_changeMRMDistanceSetup(swigCPtr, this, distanceFinest, distanceMiddle, distanceCoarsest);
  }

  public IMeshGeom supportMeshBlockRendering(CTransformShape trans, SWIGTYPE_p_float polygonCount) {
    long cPtr = nel3dJNI.CMeshMultiLod_supportMeshBlockRendering(swigCPtr, this, CTransformShape.getCPtr(trans), trans, SWIGTYPE_p_float.getCPtr(polygonCount));
    return (cPtr == 0) ? null : new IMeshGeom(cPtr, false);
  }

  public float getNumTriangles(float distance) {
    return nel3dJNI.CMeshMultiLod_getNumTriangles(swigCPtr, this, distance);
  }

  public float getNumTrianglesWithCoarsestDist(float distance, float coarsestMeshDist) {
    return nel3dJNI.CMeshMultiLod_getNumTrianglesWithCoarsestDist(swigCPtr, this, distance, coarsestMeshDist);
  }

}
